package cn.autumnorange.authorization.security.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;

@Component
@Order(2)
public class AskForLeave implements CommandLineRunner {
    @Autowired
    private WebApplicationContext
            webApplicationContext;

    @Override
    public void run(String... args) throws Exception {
        askForLeave();
    }

    public void askForLeave() {

        String WX_APPID = "wx4015d0728f8aa1aa";
//        wx0ce90cbf4e8047dc wx4015d0728f8aa1aa
        String WX_APPSECRET = "ee903e3dc1ba705ebc8d280f130e5312";
//        48e2d82633da39dcef2cc48fb56cb3e9 ee903e3dc1ba705ebc8d280f130e5312
        AccessTokenThread.appid = WX_APPID;
        AccessTokenThread.appsecret = WX_APPSECRET;

//        if ("".equals(AccessTokenThread.appid) || "".equals(AccessTokenThread.appsecret)) {
//            System.out.println("appid和appsecret未给出");
//        } else {
//
//        }
        new Thread(new AccessTokenThread(webApplicationContext)).start();
        new Thread(new JsApiTicketThread(webApplicationContext)).start();
    }
}